from typing import List


class Solution:
    def getMinDistance(self, nums: List[int], target: int, start: int) -> int:
        ans = len(nums)
        for i in range(len(nums)):
            if nums[i] == target:
                ans = min(ans, abs(i - start))
        return ans


if __name__ == "__main__":
    print(Solution().getMinDistance(nums=[1, 2, 3, 4, 5], target=5, start=3))  # 1
    print(Solution().getMinDistance(nums=[1], target=1, start=0))  # 0
    print(Solution().getMinDistance(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], target=1, start=0))  # 0
